#ifndef WXSTATECTRL_H
#define WXSTATECTRL_H

#include <wx/wxprec.h>

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include <wx/wx.h>
#endif

#include <map>

typedef int wxStateId;

/**
	Base state class. Contains no data, only used for polymorphism.
*/
class wxState : public wxObject
{
	DECLARE_DYNAMIC_CLASS( wxState )
public:
	const wxStateId m_id;
	wxState() : m_id( -1 ){}
	wxState( wxStateId id ) : m_id( id ){}
	virtual ~wxState(){}
};

typedef std::map< wxStateId, wxState* >::iterator wxStateMapIterator;
typedef std::map< wxStateId, wxState* > wxStateMap;

/**
	Base state control class. Manages state map and deletes state on destruction.
*/
class wxStateCtrl : public wxControl
{
public:

	/** Constructor. @see wxWindow */
	wxStateCtrl( wxWindow* parent, wxWindowID id, wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxNO_BORDER );

	/** Destructor. */
	virtual ~wxStateCtrl();

	/**
	Adds a wxState to the available states.
	@param state The state to add.
	@return false If the state already exists.
	*/
	bool AddState( wxState* state );

	/**
	Removes a wxState from the available states.
	@param id The state to remove.
	@return false If the state did not exist.
	*/
	bool RemoveState( wxStateId id );

	/**
	Gets a wxState from the available states.
	@param id The state to get.
	@return NULL If the state does not exist.
	*/
	wxState* GetState( wxStateId id );

	/**
	Gets the numer of available states.
	@return The number of the available states.
	*/
	size_t GetStateCount();

	/**
	Checks for existence of the state.
	@return true If the state exists, fasle otherwise.
	*/
	bool Exists( wxStateId id );

	/**
	Changes the visible state of the control to one of the available states.
	@param id The state to set.
	@return false If the state does not exist.
	*/
	virtual bool SetCurrentState( wxStateId id ) = 0;

	/**
	Gets the visible state of the control.
	@return NULL If there is not current state.
	*/
	virtual wxState* GetCurrentState() = 0;

protected:

	wxStateMap m_states;

private:


};

#endif
